package com.it.plic;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

/**
 * @author げっしょく
 * @date 2021/8/8
 */

public class Demo2_1 {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket(10000);
        byte[] b = new byte[1024];
        DatagramPacket dp = new DatagramPacket(b, b.length);
        while (true){
            ds.receive(dp);
            int length = dp.getLength();
            System.out.println(new String(b, 0, length));
        }
    }
}
